import Vuex from 'vuex'
import Vue from 'vue'

Vue.use(Vuex)

// const debug = process.env.NODE_ENV !== 'production'

const state = {
  statisData: {},
  tableData: [],
  searchTableResult: [],
  windowHeight: document.body.offsetHeight
}

const mutations = {
  setStatisData (state, resData) {
    state.statisData = resData
  },
  setTableData (state, data) {
    state.state = data
  }
}
// 异步处理放在actions里 最后再commit
const actions = {
  setStatisData (context, resData) {
    context.commit('setStatisData', resData)
  }
}

const getters = {
  getStatisData: state => {
    return state.statisData
  }
}

export default new Vuex.Store({
  state,
  mutations,
  getters,
  actions
  // plugins: debug ? [crea]
})
